<?php
/**
 * 编写者：Jayson
 * 编写日期：2024-06-12 15:41:55
 */

use App\Http\Controllers\admin\LoginController;
use App\Http\Controllers\admin\ProductController;
use App\Http\Controllers\admin\UploadController;
use App\Http\Controllers\admin\UsersController;
use App\Http\Controllers\system\AdminUserController;
use App\Http\Controllers\system\ConfigureController;
use App\Http\Controllers\system\PermissionController;
use App\Http\Controllers\system\RoleController;
use App\Http\Controllers\system\StatisticsController;
use Illuminate\Support\Facades\Route;

Route::prefix('/admin')->group(function () {
    // 图片上传
    Route::post('upload/uploads_submit', [UploadController::class, 'uploadsSubmit']);
    // 获取登录验证码
    Route::get('/login/get_login_code', [LoginController::class, 'getLoginCode']);
    // 登录
    Route::post('/login/signIn', [LoginController::class, 'signIn']);
    // 退出登录
    Route::post('/login/signOut', [LoginController::class, 'signOut']);
});
Route::prefix('/admin')->middleware('check_permis')->group(function () {

    Route::middleware('admin.token')->group(function () {

        Route::prefix('system')->group(function() {
            // 后台首页统计
            Route::post('get_home_statistics_data', [StatisticsController::class, 'getHomeStatisticsData']);
            // 后台用户信息
            Route::post('get_system_user_info', [AdminUserController::class, 'getSystemUserInfo']);
            // 后台用户修改密码
            Route::post('system_user_password_submit', [AdminUserController::class, 'systemUserPasswordSubmit']);

            // 获取管理员列表页面数据
            Route::get('get_admin_list_data', [AdminUserController::class, 'getAdminListData']);
            // 管理员表单提交
            Route::post('system_user_form_submit', [AdminUserController::class, 'systemUserFormSubmit']);
            // 获取角色列表页面数据
            Route::get('role/index', [RoleController::class, 'index']);
            //无需权限
            Route::get('role/select', [RoleController::class, 'select']);
            Route::post('role/add', [RoleController::class, 'add']);
            Route::post('role/edit', [RoleController::class, 'update']);
            Route::post('role/edit_permission', [RoleController::class, 'editPermission']);
            Route::post('role/delete', [RoleController::class, 'delete']);

            Route::get('permission/index', [PermissionController::class, 'index']);
            Route::post('permission/add', [PermissionController::class, 'add']);
            Route::post('permission/edit', [PermissionController::class, 'update']);
            Route::post('permission/delete', [PermissionController::class, 'delete']);
        });

        Route::prefix('config')->group(function() {
            // 获取常规配置页面数据
            Route::post('get_Convention_data', [ConfigureController::class, 'getConventionData']);
            // 更新常规配置
            Route::post('convention_form_submit', [ConfigureController::class, 'conventionFormSubmit']);
            // 获取用户配置页面数据
            Route::post('get_user_data', [ConfigureController::class, 'getUserData']);
            // 更新用户配置
            Route::post('user_form_submit', [ConfigureController::class, 'userFormSubmit']);
        });

        Route::prefix('users')->group(function() {
            // 获取用户列表页面数据
            Route::post('get_users_list_data', [UsersController::class, 'getUsersListData']);
            // 获取用户详情
            Route::post('get_users_info_data', [UsersController::class, 'getUsersInfoData']);
            // 用户表单提交
            Route::post('users_form_submit', [UsersController::class, 'usersFormSubmit']);
            // 获取用户提现记录列表页面数据
            Route::post('get_users_withdraw_list_data', [UsersController::class, 'getUsersWithdrawListData']);
            // 用户提现记录驳回提交
            Route::post('users_withdraw_reject_submit', [UsersController::class, 'usersWithdrawRejectSubmit']);
            // 打款用户提交
            Route::post('users_withdraw_pay_submit', [UsersController::class, 'usersWithdrawPaySubmit']);
        });

        Route::prefix('product')->group(function() {
            // 获取产品列表页面数据
            Route::post('get_product_list_data', [ProductController::class, 'getProductListData']);
            // 更新产品列表上下架状态
            Route::post('product_update_status', [ProductController::class, 'productUpdateStatus']);
            // 删除产品提交
            Route::post('product_delete_submit', [ProductController::class, 'productDeleteSubmit']);
            // 获取产品详情表单数据
            Route::post('get_product_form_data', [ProductController::class, 'getProductFormData']);
            // 产品表单数据提交
            Route::post('product_form_submit', [ProductController::class, 'productFormSubmit']);
            // 获取产品分类列表页面数据
            Route::post('get_product_class_list_data', [ProductController::class, 'getProductClassListData']);
            // 删除产品分类
            Route::post('product_class_delete_submit', [ProductController::class, 'productClassDeleteSubmit']);
            // 获取产品分类表单数据
            Route::post('get_product_class_form_data', [ProductController::class, 'getProductClassFormData']);
            // 产品分类表单数据提交
            Route::post('product_class_form_submit', [ProductController::class, 'productClassFormSubmit']);
        });

    });

});





/***************************************** 前端 ****************************************/
Route::prefix('applet')->group(function () {
    // 获取微信头像
    Route::post('get_user_avatar', [App\Http\Controllers\applet\LoginController::class, 'getUserAvatar']);
    // 发送验证码
    Route::get('captcha', [App\Http\Controllers\applet\LoginController::class, 'sendCaptcha']);
    // 注册提交
    Route::post('register_submit', [App\Http\Controllers\applet\LoginController::class, 'register']);
    // 密码登录提交
    Route::post('password_login_submit', [App\Http\Controllers\applet\LoginController::class, 'passwordLoginSubmit']);
    // 登录提交
    Route::post('captcha_login_submit', [App\Http\Controllers\applet\LoginController::class, 'captchaLoginSubmit']);
    // 忘记密码
    Route::post('forget_password', [App\Http\Controllers\applet\LoginController::class, 'forgetPassword']);

});


Route::middleware('auth.token')->group(function () {
    // 首页
    Route::get('home/index', [App\Http\Controllers\api\IndexController::class, 'index']);

    // 获取挂载教程列表
    Route::get('mount/get_mount_course_list', [App\Http\Controllers\api\MountController::class, 'getMountCourseList']);
    // 获取挂载教程详情
    Route::get('mount/get_mount_course_detail', [App\Http\Controllers\api\MountController::class, 'getMountCourseDetail']);

    // 获取新闻列表
    Route::get('news/get_news_list', [App\Http\Controllers\api\NewsController::class, 'getNewsList']);
    // 删除新闻列表
    Route::post('news/delete_news', [App\Http\Controllers\api\NewsController::class, 'deleteNews']);
    // 获取新闻详情
    Route::get('news/get_news_detail', [App\Http\Controllers\api\NewsController::class, 'getNewsDetail']);

    // 获取客服二维码
    Route::get('customer_service/get_customer_service_qrcode', [App\Http\Controllers\api\CustomerServiceController::class, 'getCustomerServiceQrcode']);

    // 用户
    Route::prefix('users')->group(function () {
        // 获取用户信息
        Route::post('get_user_info_data', [\App\Http\Controllers\users\UsersController::class, 'getUserInfoData']);
        // 获取用户详细信息
        Route::post('get_user_detail_data', [\App\Http\Controllers\users\UsersController::class, 'getUserDetailData']);
        // 小程序推出登录
        Route::post('wechat_logout', [App\Http\Controllers\applet\LoginController::class, 'wechatLogout']);
        // 获取用户设置
        Route::post('get_user_setting_data', [\App\Http\Controllers\users\UsersController::class, 'getUserSettingData']);
        // 用户开关设置
        Route::post('set_user_switch', [\App\Http\Controllers\users\UsersController::class, 'setUserSwitch']);
        // 用户设置表单提交
        Route::post('user_setting_submit', [\App\Http\Controllers\users\UsersController::class, 'userSettingSubmit']);
        // 获取注销账号页面数据;
        Route::post('get_cancel_account_data', [\App\Http\Controllers\users\UsersController::class, 'getCancelAccountData']);
        // 确定注销账号提交
        Route::post('cancel_account_submit', [\App\Http\Controllers\users\UsersController::class, 'cancelAccountSubmit']);
        // 选择身份确认
        Route::post('select_identity_submit', [\App\Http\Controllers\users\UsersController::class, 'selectIdentitySubmit']);
        // 用户提现表单提交
        Route::post('withdraw_submit', [\App\Http\Controllers\users\UsersController::class, 'userWithdrawSubmit']);
        // 获取体现提交成功页面数据
        Route::get('get_withdraw_success_data', [\App\Http\Controllers\users\UsersController::class, 'getWithdrawSuccessData']);
    });

    // 产品
    Route::prefix('product')->group(function () {
        // 获取产品广场页面数据
        Route::get('get_product_square_data', [\App\Http\Controllers\product\ProductController::class, 'getProductSquareData']);
        // 获取产品详情产品介绍页面数据
        Route::get('get_product_detail_introduce_data', [\App\Http\Controllers\product\ProductController::class, 'getProductDetailIntroduceData']);
        // 获取产品详情页面数据
        Route::get('get_product_detail_data', [\App\Http\Controllers\product\ProductController::class, 'getProductDetailData']);
        // 获取产品介绍列表页面数据
        Route::get('get_product_introduce_list_data', [\App\Http\Controllers\product\ProductController::class, 'getProductIntroduceListData']);
    });

    // 等级
    Route::prefix('level')->group(function () {
        // 获取等级区别页面数据
        Route::get('get_level_difference_data', [App\Http\Controllers\users\LevelController::class, 'getLevelDifferenceData']);
    });

});
